package com.minimalist.common.feign.client.lindi;

import com.minimalist.common.config.mybatis.bo.PageResp;
import com.minimalist.common.entity.lindi.vo.contracttemplate.LindiContractTemplateVO;
import com.minimalist.common.entity.lindi.vo.tradeapplicationtemplatecontract.LindiTradeApplicationTemplateContractQueryVO;
import com.minimalist.common.entity.lindi.vo.tradeapplicationtemplatecontract.LindiTradeApplicationTemplateContractVO;
import com.minimalist.common.feign.config.FeignConfig;
import com.minimalist.common.feign.fallback.lindi.LindiTradeApplicationTemplateContractFeignClientFallbackFactory;
import com.minimalist.common.response.R;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 林地指标交易平台_交易申请合同模板 Feign 客户端
 *
 * @author 11987
 */
@FeignClient(name = "minimalist-lindi"
        , contextId = "lindiTradeApplicationTemplateContractFeignClient"
        , path = "/minimalist/lindi/tradeApplicationTemplateContract"
        , configuration = FeignConfig.class
        , fallbackFactory = LindiTradeApplicationTemplateContractFeignClientFallbackFactory.class)
public interface LindiTradeApplicationTemplateContractFeignClient{

    /**
     * 添加交易申请合同模板
     *
     * @param tradeApplicationTemplateContractVO 交易申请合同模板信息
     * @return 成功或失败
     */
    @PostMapping("/addTradeApplicationTemplateContract")
    @Operation(summary = "添加交易申请合同模板")
    R<?> addTradeApplicationTemplateContract(
            @RequestBody @Validated(Add.class)
            LindiTradeApplicationTemplateContractVO tradeApplicationTemplateContractVO);

    /**
     * 删除交易申请合同模板 -> 根据交易申请合同模板ID删除
     *
     * @param tradeApplicationTemplateContractId 交易申请合同模板ID
     * @return 成功或失败
     */
    @DeleteMapping("/deleteTradeApplicationTemplateContractByTradeApplicationTemplateContractId")
    @Operation(summary = "删除交易申请合同模板 -> 根据交易申请合同模板ID删除")
    R<?> deleteTradeApplicationTemplateContractByTradeApplicationTemplateContractId(
            @RequestParam("tradeApplicationTemplateContractId")
            @NotNull(message = "交易申请合同模板ID不能为空")
            @Parameter(name = "tradeApplicationTemplateContractId", required = true, description = "交易申请合同模板ID")
            Long tradeApplicationTemplateContractId);

    /**
     * 修改交易申请合同模板
     *
     * @param tradeApplicationTemplateContractVO 交易申请合同模板信息
     * @return 成功或失败
     */
    @PutMapping("/updateTradeApplicationTemplateContractByTradeApplicationTemplateContractId")
    @Operation(summary = "修改交易申请合同模板")
    R<?> updateTradeApplicationTemplateContractByTradeApplicationTemplateContractId(
            @RequestBody @Validated(Update.class)
            LindiTradeApplicationTemplateContractVO tradeApplicationTemplateContractVO);

    /**
     * 查询交易申请合同模板列表(分页)
     *
     * @param queryVO 查询条件
     * @return 交易申请合同模板列表
     */
    @GetMapping("/getPageTradeApplicationTemplateContractList")
    @Operation(summary = "查询交易申请合同模板列表(分页)")
    R<PageResp<LindiTradeApplicationTemplateContractVO>> getPageTradeApplicationTemplateContractList(
            @RequestBody LindiTradeApplicationTemplateContractQueryVO queryVO);

    /**
     * 根据交易申请合同模板ID查询交易申请合同模板
     *
     * @param tradeApplicationTemplateContractId 交易申请合同模板ID
     * @return 交易申请合同模板
     */
    @GetMapping("/getTradeApplicationTemplateContractByTradeApplicationTemplateContractId/{tradeApplicationTemplateContractId}")
    @Operation(summary = "根据交易申请合同模板ID查询交易申请合同模板")
    R<LindiTradeApplicationTemplateContractVO> getTradeApplicationTemplateContractByTradeApplicationTemplateContractId(
            @PathVariable(value = "tradeApplicationTemplateContractId")
            @NotNull(message = "交易申请合同模板ID不能为空")
            @Parameter(name = "tradeApplicationTemplateContractId", description = "交易申请合同模板ID", required = true)
            Long tradeApplicationTemplateContractId);

    /**
     * 删除交易申请合同模板文件 -> 根据文件ID删除
     *
     * @param fileId 文件ID
     * @return 成功或失败
     */
    @PostMapping("/deleteTradeApplicationTemplateContractFileByFileId")
    @Operation(summary = "删除交易申请合同模板文件 -> 根据文件ID删除")
    R<?> deleteTradeApplicationTemplateContractFileByFileId(
            @RequestParam("fileId")
            @NotNull(message = "文件ID不能为空")
            @Parameter(name = "fileId", description = "文件ID", required = true)
            Long fileId);

    /**
     * 获取合同模板列表
     *
     * @return 合同模板列表
     */
    @GetMapping("/getContractTemplateList")
    @Operation(summary = "获取合同模板列表")
    R<List<LindiContractTemplateVO>> getContractTemplateList();

    /**
     * 生成交易申请合同模板
     *
     * @param tradeApplicationId 交易申请ID
     * @param contractTemplateId 合同模板ID
     * @param contractType       合同类型
     * @param createId           创建人ID
     * @param tenantId           租户ID
     * @return 成功或失败
     */
    @PostMapping("/generateTemplateContract")
    @Operation(summary = "生成交易申请合同模板")
    R<?> generateTemplateContract(
            @RequestParam("tradeApplicationId") @NotNull(message = "交易申请ID不能为空")
            Long tradeApplicationId,
            @RequestParam("contractTemplateId") @NotNull(message = "合同模板ID不能为空")
            Long contractTemplateId,
            @RequestParam("contractType") @NotNull(message = "合同类型不能为空")
            String contractType,
            @RequestParam("createId") @NotNull(message = "创建人ID不能为空") Long createId,
            @RequestParam("tenantId") @NotNull(message = "租户ID不能为空") Long tenantId);
}